export const getStorage = (key) => {
  const val = uni.getStorageSync(key);
  return val ? JSON.parse(val) : null;
}

export const setStorage = (key, value) => {
  if (!value) {
    uni.removeStorageSync(key);
  } else {
    uni.setStorageSync(key, JSON.stringify(value));
  }
}

export const removeStorage = (key) => {
  uni.removeStorageSync(key);
}
export const removeAllStroage = () => {
  uni.removeStorageSync("token");
  uni.removeStorageSync("userInfo");
  uni.removeStorageSync("countriesData");
  uni.removeStorageSync("history");
}